import request from '@/utils/request'

// 查询学生管理列表
export function listStudent(query) {
  return request({
    url: '/dorm/student/list',
    method: 'get',
    params: query
  })
}

// 查询学生管理详细
export function getStudent(studentId) {
  return request({
    url: '/dorm/student/' + studentId,
    method: 'get'
  })
}

// 新增学生管理
export function addStudent(data) {
  return request({
    url: '/dorm/student',
    method: 'post',
    data: data
  })
}

// 修改学生管理
export function updateStudent(data) {
  return request({
    url: '/dorm/student',
    method: 'put',
    data: data
  })
}

// 删除学生管理
export function delStudent(studentId) {
  return request({
    url: '/dorm/student/' + studentId,
    method: 'delete'
  })
}

// 查询宿舍下拉树结构
export function dormTreeSelect() {
  return request({
    url: '/dorm/student/dormTree',
    method: 'get'
  })
}

//查询是否为学生账号
export function isStudent(username) {
  return request({
    url: '/dorm/student/isStudent/' + username,
    method: 'get'
  })
}

//查询学生账号学生信息是否填写
export function isStudentInfoFilled(username) {
  return request({
    url: '/dorm/student/isStudentInfoFilled/' + username,
    method: 'get'
  })
}

//查询学生账号学生信息
export function getStudentInfo() {
  return request({
    url: '/dorm/student/getStudentInfo',
    method: 'get'
  })
}


// 用户端修改学生信息（仅学生信息）
export function updateStudentInfo(data) {
  return request({
    url: '/dorm/student/updateStudentInfo',
    method: 'put',
    data: data
  })
}